package com.ruoyi.project.system.membershare.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.text.Convert;
import com.ruoyi.project.system.membershare.domain.MemberShare;
import com.ruoyi.project.system.membershare.mapper.MemberShareMapper;
import com.ruoyi.project.system.membershare.service.IMemberShareService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 用户分享Service业务层处理
 * 
 * @author LCL
 * @date 2020-12-18
 */
@Service
public class MemberShareServiceImpl implements IMemberShareService 
{
    @Autowired
    private MemberShareMapper memberShareMapper;

    /**
     * 查询用户分享
     * 
     * @param id 用户分享ID
     * @return 用户分享
     */
    @Override
    public MemberShare selectMemberShareById(String id)
    {
        return memberShareMapper.selectMemberShareById(id);
    }

    /**
     * 查询用户分享列表
     * 
     * @param memberShare 用户分享
     * @return 用户分享
     */
    @Override
    public List<MemberShare> selectMemberShareList(MemberShare memberShare)
    {
        return memberShareMapper.selectMemberShareList(memberShare);
    }

    /**
     * 新增用户分享
     * 
     * @param memberShare 用户分享
     * @return 结果
     */
    @Override
    public int insertMemberShare(MemberShare memberShare)
    {
        return memberShareMapper.insertMemberShare(memberShare);
    }

    /**
     * 修改用户分享
     * 
     * @param memberShare 用户分享
     * @return 结果
     */
    @Override
    public int updateMemberShare(MemberShare memberShare)
    {
        memberShare.setUpdateTime(DateUtils.getNowDate());
        return memberShareMapper.updateMemberShare(memberShare);
    }

    /**
     * 删除用户分享对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteMemberShareByIds(String ids)
    {
        return memberShareMapper.deleteMemberShareByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除用户分享信息
     * 
     * @param id 用户分享ID
     * @return 结果
     */
    @Override
    public int deleteMemberShareById(String id)
    {
        return memberShareMapper.deleteMemberShareById(id);
    }

    @Override
    public MemberShare selectMemberShareByMemberId(String memberId) {
        return memberShareMapper.selectMemberShareByMemberId(memberId);
    }
}
